<html><head>

        <title>Formulir Data Penduduk</title> 
        <link href="<?php echo base_url('assets/css/formpenduduk.css'); ?>" rel="stylesheet" type="text/css" />
        <link href="<?php echo base_url('assets/js/jquery-ui.css'); ?>" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="<?php echo base_url('assets/js/jquery-1.9.1.js'); ?>"></script>
        <script type="text/javascript" src="<?php echo base_url('assets/js/jquery-ui.js'); ?>"></script>

        <style type="text/css">
            <!--
            .style1 {color: #F0F0F0}
            .style2 {font-size: 24px}
            -->
        </style>
        <script type="text/javascript">
            $(function() {
                $("#tgl_lahir").datepicker({changeMonth: true, changeYear: true});
                $("#tgl_suratnikah").datepicker({changeMonth: true, changeYear: true});
                $("#tgl_suratcerai").datepicker({changeMonth: true, changeYear: true});
            });
        </script>

        <script language="javascript">
function validasi(form) {
                if (form.nik.value == "") {
                    alert("Anda belum mengisikan Nama.");
                    form.nik.focus();
                    return (false);
                }
                if (form.nama.value == "") {
                    alert("Anda belum mengisikan Nama.");
                    form.nama.focus();
                    return (false);
                }
                if (form.tempat_lahir.value == "") {
                    alert("Anda belum mengisikan Nama.");
                    form.tempat_lahir.focus();
                    return (false);
                }
                if (form.tgl_lahir.value == "") {
                    alert("Anda belum mengisikan Nama.");
                    form.tgl_lahir.focus();
                    return (false);
                }
                if (form.alamat.value == "") {
                    alert("Anda belum mengisikan Alamat.");
                    form.alamat.focus();
                    return (false);
                }
                if (form.telpon.value == "") {
                    alert("Anda belum mengisikan Telpon.");
                    form.telpon.focus();
                    return (false);
                }
                if (form.email.value == "") {
                    alert("Anda belum mengisikan Email.");
                    form.email.focus();
                    return (false);
                }
                if (form.kota.value == 0) {
                    alert("Anda belum mengisikan Kota.");
                    form.kota.focus();
                    return (false);
                }
                if (form.kode.value == "") {
                    alert("Anda belum mengisikan Kode.");
                    form.kode.focus();
                    return (false);
                }
                return (true);
            }
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
</script>
    </head>
    <body>
        
        <form action="<?php echo base_url('penduduk/tambah'); ?>" method="post" onSubmit=return validasi(this)>
              <table width="715" border="0" align="center">
                <tr>
                    <td colspan="8" class="trheader"><strong>Formulir Data Penduduk</strong></td>
                </tr>
                <tr>
                    <td colspan="8" class="jeda"><strong>Data Personal Penduduk </strong></td>
                </tr>
                <tr>
                    <td width="122">NIK</td>
                    <td colspan="3"><input type="text" name="nik" id="nik" class="textinput" placeholder="3501061411910002" value=""/></td>
                    <td width="5">&nbsp;</td>
                    <td width="147">Nama</td>
                    <td colspan="2"><input type="text" name="nama" id="nama" class="textinput" placeholder="Niken Larasati" /></td>
                </tr>
                <tr>
                    <td>Tempat Lahir</td>
                    <td colspan="3"><input type="text" name="tempat_lahir" id="tempat_lahir" class="textinput" placeholder="Pacitan"/></td>
                    <td>&nbsp;</td>
                    <td>Tanggal Lahir</td>
                    <td colspan="2"><input type="text" name="tgl_lahir" id="tgl_lahir" class="textinput"/></td>
                </tr>
                <tr>
                    <td>Jenis Kelamin</td><td><select name="idjenis_kelamin" class="list">
                            <?php
                            if (isset($jenis_kelamin)) {
                                foreach ($jenis_kelamin->result() as $data_jenis_kelamin) {
                                    echo '<option value="' . $data_jenis_kelamin->idjenis_kelamin . '">' . $data_jenis_kelamin->jenis_kelamin . '</option>';
                                }
                            }
                            ?>
                        </select>
                    </td><td></td>
                </tr>
                <tr>
                    <td>Pendidikan Akhir</td>
                    <td colspan="3"><select name="idpendidikan" class="list">
                            <?php
                            if (isset($pendidikan)) {
                                foreach ($pendidikan->result() as $data_pendidikan) {
                                    echo '<option value="' . $data_pendidikan->idpendidikan . '">' . $data_pendidikan->pendidikan . '</option>';
                                }
                            }
                            ?>
                        </select></td>
                    <td>&nbsp;</td>
                    <td>Golongan darah</td>
                    <td colspan="2"><select name="idgol_darah" id="idgol_darah" class="list">
                            <?php
                            if (isset($gol_darah)) {
                                foreach ($gol_darah->result() as $data_gol_darah) {
                                    echo '<option value="' . $data_gol_darah->idgol_darah . '">' . $data_gol_darah->gol_darah . '</option>';
                                }
                            }
                            ?>
                        </select></td>
                </tr>
                <tr>
                    <td>Agama</td>
                    <td colspan="3"><select name="idagama" id="idagama" class="list">
                            <?php
                            if (isset($agama)) {
                                foreach ($agama->result() as $data_agama) {
                                    echo '<option value="' . $data_agama->idagama . '">' . $data_agama->agama . '</option>';
                                }
                            }
                            ?>
                        </select></td>
                    <td>&nbsp;</td>
                    <td>Pekerjaan</td>
                    <td colspan="2"><select name="idpekerjaan" id="idpekerjaan" class="list">
                            <?php
                            if (isset($pekerjaan)) {
                                foreach ($pekerjaan->result() as $data_pekerjaan) {
                                    echo '<option value="' . $data_pekerjaan->idpekerjaan . '">' . $data_pekerjaan->pekerjaan . '</option>';
                                }
                            }
                            ?>
                        </select></td>
                </tr>
                <tr>
                    <td>Kewarganegaraan</td>
                    <td colspan="3"><select name="idkewarganegaraan" id="idkewarganegaraan" class="list">
                            <?php
                            if (isset($kewarganegaraan)) {
                                foreach ($kewarganegaraan->result() as $data_kewarganegaraan) {
                                    echo '<option value="' . $data_kewarganegaraan->idkewarganegaraan . '">' . $data_kewarganegaraan->kewarganegaraan . '</option>';
                                }
                            }
                            ?>
                        </select></td>
                    <td>&nbsp;</td>
                    <td>Keturunan</td>
                    <td colspan="2"><input type="text" name="keturunan" id="keturunan" class="textinput" /></td>
                </tr>
                <tr>
                    <td>Status Perkawinan</td>
                    <td colspan="3"><select name="idstatus_kawin" id="idstatus_kawin" class="list">
                            <?php
                            if (isset($status_kawin)) {
                                foreach ($status_kawin->result() as $data_status_kawin) {
                                    echo '<option value="' . $data_status_kawin->idstatus_kawin . '">' . $data_status_kawin->status_kawin . '</option>';
                                }
                            }
                            ?>
                        </select></td>
                    <td>&nbsp;</td>
                    <td> Status dalam Keluarga</td>
                    <td colspan="2"><select name="idstatus_keluarga" class="list" id="idstatus_keluarga">
                            <?php
                            if (isset($status_keluarga)) {
                                foreach ($status_keluarga->result() as $data_status_keluarga) {
                                    echo '<option value="' . $data_status_keluarga->idstatus_keluarga . '">' . $data_status_keluarga->status_keluarga . '</option>';
                                }
                            }
                            ?>
                        </select></td>
                </tr>
                <tr>
                    <td>Status Menetap</td>
                    <td colspan="3">
                        <select name="status" id="status" class="list">
                            <option value="1">Aktif</option>
                            <option value="0">Non-aktif</option>
                        </select></td>
                    <td>&nbsp;</td>
                    <td>Telp</td>
                    <td colspan="2"><input type="text" name="telp" id="telp" class="textinput" placeholder="089761976713"/></td>
                </tr>
                <tr>
                    <td>Nama Ayah</td>
                    <td colspan="3"><input type="text" name="nama_ayah" id="nama_ayah" class="textinput" placeholder="Supeni"/></td>
                    <td>&nbsp;</td>
                    <td>Nama Ibu</td>
                    <td colspan="2"><input type="text" name="nama_ibu" id="nama_ibu" class="textinput" placeholder="Sumarni"/></td>
                </tr>
                <tr>
                    <td colspan="8">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="8" class="jeda"><strong>Data Dokumen Penduduk</strong></td>
                </tr>
                <tr>
                    <td>No. Kartu Keluarga</td>
                    <td colspan="3"><input type="text" name="no_kk" id="no_kk" class="textinput" placeholder="3501062001053536"/></td>
                    <td>&nbsp;</td>
                    <td>No. Surat Nikah</td>
                    <td colspan="2"><input type="text" name="no_suratnikah" id="no_suratnikah" class="textinput" placeholder=""/></td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td colspan="3">&nbsp;&nbsp;&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>Tanggal Nikah</td>
                    <td colspan="2"><input type="text" name="tgl_suratnikah" id="tgl_suratnikah" class="textinput" placeholder=""/></td>
                </tr>
                <tr>
                    <td>No. Paspor</td>
                    <td colspan="3"><input type="text" name="no_passpor" id="no_passpor" class="textinput" placeholder=""/></td>
                    <td>&nbsp;</td>
                    <td>No. Surat Cerai</td>
                    <td colspan="2"><input type="text" name="no_suratcerai" id="no_suratcerai" class="textinput" placeholder=""/></td>
                </tr>
                <tr>
                    <td>No. Kitas</td>
                    <td colspan="3"><input type="text" name="no_kitas" id="no_kitas" class="textinput" placeholder=""/></td>
                    <td>&nbsp;</td>
                    <td>Tanggal Cerai</td>
                    <td colspan="2"><input type="text" name="tgl_suratcerai" id="tgl_suratcerai" class="textinput" placeholder=""/></td>
                </tr>
                <tr>
                    <td colspan="8">&nbsp;</td>
                </tr>
                <tr>
                    <td><!--<input type="submit" name="lihat" id="lihat" value="Lihat Data" class="radiobutton-kiri" /></td>-->
                    <td colspan="3">                    
                    <td>                    
                    <td colspan="3"><input name="tambah" type="submit" class="btn btn-large" id="tambah" onClick="MM_popupMsg('Data Berhasil Ditambahkan!')" value="Tambah"/>
                      </tr>
            </table>
              
        </form>
        <?php
        if(isset($_POST['tambah'])){
        if (empty($_POST[nik]) || empty($_POST[nama]) || empty($_POST[tempat_lahir]) || empty($_POST[tgl_lahir]) || empty($_POST[keturunan]) || empty($_POST[telp]) || empty($_POST[no_kk])){
        echo "Data yang Anda isikan belum lengkap<br />
  	    <a href='selesai-belanja.html'><b>Ulangi Lagi</b>";
        }
        }
        ?>
    </body>
</html>
